import dotenv from "dotenv";
import express from "express";
import path from "path";

import * as routes from "./routes";


dotenv.config();

const port = process.env.SERVER_PORT;
const app = express();

// Configure Express to use EJS
console.log(__dirname)
app.set( "views", path.join( __dirname, "views" ) );
app.set( "view engine", "ejs" );

routes.register(app);
// Configure Express to parse incoming JSON data
app.use( express.json() );


// Configure Express to serve static files in the public folder
app.use( express.static( path.join( __dirname, "public" ) ) );

app.listen(port, ()=>{
    // tslint:disable-next-line:no-console
    console.log(`server started at http://localhost:${port}`)
})
